package org.idea.qiyu.framework.demo.apm.servlet.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.idea.qiyu.framework.apm.test.interfaces.service.goods.IGoodsService;
import org.idea.qiyu.framework.apm.test.interfaces.service.user.IUserService;
import org.idea.qiyu.framework.demo.apm.servlet.user.dao.UserDao;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author linhao
 * @Date created in 3:15 下午 2021/7/18
 */
@RestController
@RequestMapping(value = "/agent/test")
public class AgentTestController {

    @Resource
    private UserDao userDao;
    @DubboReference
    private IGoodsService iGoodsService;
    @DubboReference
    private IUserService iUserService;

    @PostMapping(value = "/do-post")
    public String doPost(String username, String password) {
        System.out.println("this is :" + username + " password is " + password);
        String test = "do-post";
        System.out.println("this is post");
        return test;
    }

    @GetMapping(value = "/do-get")
    public String doTest() {
        System.out.println("this is do");
        System.out.println(userDao.selectAll());
        System.out.println(userDao.selectInLimit(1));
        iGoodsService.findGoods();
        iUserService.findUser();
        return "success";
    }

}
